--> Sayadasite: Use Case Diagram

Multiple Ads

Search

Menu Bar

Use Case Diagram

 Software Design, Cohesion and Coupling, Structured Design, Use Case Diagram, Sequence Diagram

3. Important UML Diagrams with Examples

Use Case Diagram

1. Use Case Diagram

Shows the interaction between users (actors) and the system.

Example: A student logs in, views results, and registers for courses.

1.        Use Case Diagram

A Use Case Diagram is a UML (Unified Modeling Language) behavioral diagram that represents the interactions between users (actors) and a system. It shows the functionalities provided by a system from the user's point of view.

It is mainly used during the requirement analysis phase of software development.

1. Components of a Use Case Diagram

1.        Actor: A person, organization, or external system that interacts with the system. Represented by a stick figure.

2.        Use Case: A function or service provided by the system. Represented by an oval.

3.        System Boundary: A rectangle that encloses the use cases and defines the scope of the system.

4.        Association: A line connecting an actor to a use case.

5.        <<include>>: Represents behavior that a use case always incorporates from another use case.

6.        <<extend>>: Represents optional or conditional behavior added to a base use case.

2. Example: Use Case Diagram for an ATM System

ATM System

Illustrative use case diagram: an ATM customer can check balance, withdraw cash, deposit money, and change a PIN.

In this example:

1.        Actor: Customer

2.        System: ATM System

3.        Use cases: Check Balance, Withdraw Cash, Deposit Money, Change PIN

4.        Associations: Lines connecting the customer to the functions they can perform.

3. Relationships in a Use Case Diagram

A. Include relationship

One use case always uses the functionality of another use case.

Example: Withdraw Cash includes Authenticate User.

B. Extend relationship

One use case adds optional or conditional behavior to another use case.

Example: Print Receipt may extend Withdraw Cash if the customer chooses to print a receipt.

C. Generalization

An actor or use case inherits characteristics or behavior from a more general actor or use case.

Example: Savings Account Customer and Current Account Customer may be specialized types of Bank Customer.

4. Advantages of Use Case Diagrams

1.          Help identify system requirements.

2.          Make system functionality easy to understand.

3.          Improve communication between users, developers, and stakeholders.

4.          Define the scope and boundaries of a system.

5.          Help in planning software testing.

6.          Document interactions between actors and the system. 

5. Conclusion

A use case diagram is an important UML tool used to represent the functional requirements of a system. It illustrates who uses the system and what functions they can perform.

Exam tip: For a 5-mark answer, write the definition, explain the four main components, draw a simple use case diagram, and list two advantages.

2. Class Diagram

Shows classes, attributes, methods, and relationships.

Example: Student and Course classes in a college system.

Class Diagram in UML

A Class Diagram is a UML (Unified Modeling Language) structural diagram that represents the static structure of a system. It shows the classes, their attributes, methods (operations), and the relationships between classes.

It is widely used in object-oriented software design to describe the structure of a system before implementation.

1. Components of a Class Diagram

  • Class: Represents an object type or blueprint for creating objects.
  • Attributes: Represent the data or properties of a class.
  • Methods (Operations): Represent the functions or behaviors performed by a class.
  • Relationships: Show how different classes are connected.

2. Example: Class Diagram for a Student Management System

1.                      System

 

 Illustrative class diagram showing the 

Student and Course classes, their attributes, 

methods, and association. (connection)

Explanation:

·         Student and Course are classes.

·         studentId, name, and course are attributes of the Student class.

·         register() and viewResult() are methods.

·         The relationship indicates that students enroll in courses.

3. Visibility Symbols in a Class Diagram

Symbol

Meaning

Example

+

Public

+ register()

-

Private

- studentId: int

#

Protected

# calculateFee()

~

Package/default visibility

~ display()

4. Relationships in a Class Diagram

1. Association

A general connection between two classes.

Example: Student enrolls in a Course.

2. Inheritance (Generalization)

One class inherits properties and methods from another class.

Example: Person → Student.

3. Aggregation

A weak whole-part relationship in which parts can exist independently.

Example: Department and Professor.

4. Composition

A strong whole-part relationship in which the part's lifecycle depends on the whole.

Example: House and Room in a typical conceptual model.

5. Dependency

One class temporarily uses or depends on another class.

5. Advantages of Class Diagrams

1.                      Represent the static structure of a system clearly.

2.                      Help developers understand object-oriented design.

3.                      Improve communication among team members.

4.                      Support code development and documentation.

5.                      Make system maintenance and modification easier.

6.                      Help identify classes and relationships before coding.

6. Conclusion

A class diagram is an important UML structural diagram that describes the classes, attributes, methods, and relationships in a software system. It provides a blueprint for implementing object-oriented software.

Exam tip: For a 5-mark answer, write the definition, draw one class with its three compartments, explain visibility symbols, and describe the main relationships. For a 10-mark answer, also include the example diagram and advantages.

No comments: